<?php namespace Member\Controller; 

use Hdphp\Controller\Controller;
use Member\Model\Address;

class AddressController extends Controller
{
	protected $db;

	//构造函数
	public function __init()
	{
		$this->db = new Address;
	}
	
    //调用显示
    public function address(){
    	if(IS_POST){    		
    		$data['postname'] = $_POST['postname'];
    		$data['postaddress'] = $_POST['sheng'].'-'.$_POST['shi'].'-'.$_POST['qu'].'-'.$_POST['postaddress'];
    		$data['postcode'] = $_POST['postcode'];
    		$data['phone'] = $_POST['phone'];
    		$data['fixedphone'] = $_POST['fixedphone'];
    		if($this->db->store($data))
    		{
    			View::success('新增收货地址成功');
    		}
    	}else{
    		$data = $this->db->getAll();
    		View::with('data',$data);
    		View::make();
    	}
       
    }
}
